package com.zb.system.entity;

import cn.dev33.satoken.secure.SaSecureUtil;
import com.zb.config.ProfileConfigUtil;
import com.zb.entity.ZjCustomer;
import com.zb.secure.BCryptUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/7/26 0026
 **/
@Data
@ApiModel("商家角色实体")
public class CustomerRoleVo {
    @ApiModelProperty("商家")
    private String code;

    @ApiModelProperty("企业名称")
    private String name;

    @ApiModelProperty(value = "企业简称")
    private String abbrevia;

    @ApiModelProperty(value = "状态：1-待审核，2-使用中，3-冻结，4-已过期")
    private Integer status;

    @ApiModelProperty(value = "开通时间")
    private Date openTime;

    @ApiModelProperty(value = "到期时间")
    private Date endTime;

    @ApiModelProperty(value = "角色")
    private String role;

    public static CustomerRoleVo beanToVo(ZjCustomer customer, String role, String aesKey) {
        CustomerRoleVo vo = new CustomerRoleVo();
        BeanUtils.copyProperties(customer, vo);
        vo.setName(customer.getFullName());
        vo.setCode(BCryptUtil.aesEncry(aesKey, customer.getId().toString()));
        vo.setRole(role);
        return vo;
    }



}
